import APIS from '../api';
import httpRequest from '../httpRequest';

/**
  ● welcome 欢迎
  ● problem 题目理解
  ● code 编码
  ● test 测试
  ● success/faild 成功/失败（结束）
 */

export type CHAT_DETAIL_TYPE = {
  id: number;
  title: string;
  problem_id: string;
  messages: {
    role: 'system' | 'assistant' | 'user';
    content: string;
  }[];
  created: string;
  stage: StageType;
};

// 会话详情
export const chatDetail = (data: { problem_id: string; _new?: boolean }) => {
  return httpRequest.get<CHAT_DETAIL_TYPE>({
    url: APIS.chatDetail + '?problem_id=' + data.problem_id,
  });
};
